package main

import (
	"os"
)

const usage = ` 
./commod.exe [cmd]
	rename 修改文件名
`
type commond struct {
	rename *RenameCommond
}

//创建实例
func NewCmd()*commond{
	cmd := commond{
		rename: new(RenameCommond),
	}
	return &cmd
}
//注册命令
func (cmd *commond)Register(){
	cmd.rename.Register() //文件重命名命令注册
}

//打印使用方法
func (cmd *commond)PrintUsage(){
	PrintMsg(usage)
	os.Exit(1)
	return
}

//运行
func (cmd *commond)Run(){
	if len(os.Args) < 2 {
		cmd.PrintUsage()
	}

	switch os.Args[1]{
	case RenameCmd:
		cmd.rename.Run(os.Args[2:])
	default:
		cmd.PrintUsage()
		os.Exit(1)
	}
}